/*                                  ATELIER                                   */

/* %%LICENSE_TAG%%                                                            */
package edu.gmu.view.cube;

import java.awt.BorderLayout;
import javax.swing.JPanel;
import edu.gmu.view.canvas.Canvas;
import edu.gmu.view.canvas.CanvasPanel;

/**
 * The CubePanel displays cube tumbling through space.
 * @author  James H. Pope
 * @version $Revision:$ $Date:$
 */
public class CubePanel extends JPanel
{
    /****************************  GUI components  ****************************/
    protected Canvas canvas = null;

    protected CubeLayer cubeLayer = null;

    /**
     * Creates a new instance of CubePanel
     * @param controlModel
     */
    public CubePanel( ControlModel controlModel )
    {   
    	BorderLayout mainLayout = new BorderLayout();
        this.setLayout( mainLayout );
        
        int frameRate = 10;
        this.canvas = new Canvas( frameRate );
        
        this.cubeLayer  = new CubeLayer( controlModel );
        cubeLayer.setName("Cube");
        cubeLayer.setVisible(true);
        this.canvas.getLayerModel().addLayer( cubeLayer );
        
        
        
        CanvasPanel canvasPanel = new CanvasPanel( canvas );
        this.add( canvasPanel, BorderLayout.CENTER );
        
        this.canvas.start();
    }

    /**
     * Gets the canvas
     * @return canvas
     */
    public Canvas getCanvas()
    {
        return this.canvas;
    }
    
}

/*                                  ATELIER                                   */